<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>
  
  <head>    
    <title>How to import a custom model into SMG1 (NEEDS UPDATES)</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link href="../../styles.css" rel="stylesheet">
    <link rel="icon" href="../../images/icon.png">
	</head>

	<body>

    <div id="top">
      <h1>How to import a custom model into SMG1 (NEEDS UPDATES)</h1> 
    </div>
			
    <div id="hot-links">
      <h2>Direct links</h2>
      <hr>
      <ol>
        <li><a href="../../index.html">Introduction</a></li>
        <li><a href="../tutorials.html">Tutorials</a></li>
        <li><a href="../resources.html">Resources</a></li>
      </ol>
    </div>
			
    <div id="main">

			<h2>Contents</h2>
			<hr>
      <ol>
				<li><a href="#tools">Required tools</a></li>
				<li><a href="#blender">About Blender</a></li>
				<li><a href="#warnings">Warnings</a></li>
				<li><a href="#steps">Steps</a></li>
				<li><a href="#other-tutorials">Other tutorials</a></li>
      </ol>
      <br>

			<hr id="tools">
			<h2>Required tools</h2>
			<hr>
      <p>Go to <a href="../resources.html">Resources</a> for download links.</p>        
      <ul>
				<li>Blender</li>
				<li>SuperBMD</li>
				<li>j3dview</li>
				<li>Collision Creator</li>
				<li>Arc Convertor</li>
				<li>Whitehole</li>
				<li>Wiimm's ISO Tools (to get your SMG1 dump)</li>
      </ul>
      <br>

			<hr id="blender">
			<h2>About Blender</h2>
			<hr>

      <p> If you don’t know how to use <code>Blender</code> yet I suggest you to see these tutorials: <a href="https://youtube.com/playlist?list=PLGLfVvz_LVvSkKXi2yl0Nd0cJVItG6AN0&si=Bk61KJIO-TEZUQwK">English</a> <a href="https://youtube.com/playlist?list=PLGW1bRAddcdrm6-Z12v9UBheJ7h9_j-aC&si=tbwPBnVEHUWPpB5F">Spanish</a></p>
      <p>Watch the basic stuff (first videos) and try creating something not that difficult. When you start doing something you will get how stuff works on <code>Blender</code> and then you can search for the info you need on the web, but you have to understand the basic stuff first.</p>
      <p>If you wonder about the older <code>Blender</code> version, I believe newer versions also work; you can try them if you want. However I don’t need a newer version so I can stay with <b>2.79</b> (<a href="https://docs.blender.org/manual/en/2.79/">Blender 2.79 Reference Manual</a>).</p>

      <br>

			<hr id="warnings">
			<h2>Warnings</h2>
			<hr>

      <p><b>1)</b> If you want to use custom textures (textures not extracted from the game) be sure that they have sizes like <b>64x64, 128x128, 64x128, etc.</b> (power of 2) otherwise <code>Whitehole</code> wont load your object and the texture will crash the console!</p>

      <p><b>2)</b> As the objects in normal size in <code>Blender</code> <b>are extremely tiny when imported on the game</b> you can decide to scale them on <code>Blender</code> (Edit Mode only) or to scale them on <code>Whitehole</code> (I choose to scale them on <code>Whitehole</code> on this tutorial).</p>

      <p><b>3)</b> If your model appears <b>white</b> in <code>Game/Whitehole</code> you forgot to apply the materials or <code>SuperBMD</code> did not assign the textures to the model (maybe you moved the textures to another place and <code>SuperBMD</code> could not locate them).</p>

      <p><b>4)</b> If your model appears as a <b>blue box</b> on <code>Whitehole</code> then you missed something in the steps or did something else wrong (the error could be anywhere with this one).</p>

      <p><b>5)</b> Do not make any scale or movement action in <code>Object Mode</code> only in <code>Edit Mode</code> if you scale or move and object while being in <code>Object Mode</code> the visual model will be improperly scaled and or positioned to the collision model in game!</p>

      <p><b>6)</b> Set your model in <code>Blender</code> to have <b>no angles</b> against any axis if your model on <code>Blender</code> has an angle with an axis, the collision and the 3d model will be rotated that angle in game!</p>

      <p><b>7)</b> Regarding rotations, translations and scaling done while not being in <code>Edit Mode</code>, <b>(2)</b> (the <code>Edit Mode</code> scaling part), <b>(5)</b> and <b>(6)</b> <b>can be completely ignored if</b>, at the end of doing the model, you reset the position, angles with any axis and scaling of the object by pressing <code>Ctrl + A</code> and, in the window that shows, click those options to reset (<b>Thanks to Gabbo for the info!</b> - <b>Fig. 0</b>).</p>

      <img src="../../images/t1/fig0.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 0 - <code>Blender</code> Apply functions)</p>
      <br>
      
      <br>

			<hr id="steps">
			<h2>Steps --- files used: <a href="https://archive.org/download/humming-owl-storage/tutorial1.zip">tutorial1.zip</a></h2>
			<hr>

      <p>First, I will assume you already have a model on <code>Blender</code> with no materials assigned. In this example I will work with <b>several materials</b> (<b>Fig. 1</b>).</p>

      <img src="../../images/t1/fig1.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 1 - <code>Blender</code> model example)</p>
      <br>

      <p>Create the materials to be used on the model. This is important since it is how the model will look on game. To assign materials, go to the right section of <code>Blender</code> and click on the <code>Material</code> tab (<b>Fig. 2</b>).</p>

      <img src="../../images/t1/fig2.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 2 - Material tab)</p>
      <br>

      <p>If you are creating the first material to be used on the model, a default material will be already there, if not then add a new material by clicking <code>+</code> (to add a new material slot) and then on the <code>New</code> button to add a material to that slot. Change its name to anything you want (you will need to know the materials name in the future - <b>Fig. 3</b>). I will create 4 materials (<code>metal1</code>, <code>wood1</code>, <code>cloth1</code> and <code>light1</code>), to add more than one material do the same mentioned above and change their names (<b>Fig. 4</b>).</p>

      <img src="../../images/t1/fig3.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 3 - Create materials)</p>
      <br>

      <img src="../../images/t1/fig4.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 4 - Example materials created)</p>
      <br>

      <p>With that done, you need to assign a texture to all materials, to do that click on a material and go to the <code>Texture</code> tab (<b>Fig. 5</b>). If a default texture is in there then erase it and add a new one, if not then add a new texture with the <code>New</code> button (<b>Fig. 5 and 6</b>).</p>

      <img src="../../images/t1/fig5.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 5 - Texture tab)</p>
      <br>

      <img src="../../images/t1/fig6.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 6 - Example texture created)</p>
      <br>

      <p>After creating a new texture, it will appear what is shown on <b>Fig. 6</b>, click on <code>Open</code> and select the texture you want to assign to your material (<b>Fig. 7 and 8</b>). You can leave the texture name as you want (you don’t need to assign a name to it). Do this to all materials created (<b>Fig. 9</b>).</p>

      <img src="../../images/t1/fig7.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 7 - Texture search)</p>
      <br>

      <img src="../../images/t1/fig8.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 8 - Texture picture selected)</p>
      <br>

      <img src="../../images/t1/fig9.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 9 - All materials with textures assigned)</p>
      <br>

      <p>After all that, now is the time to assign the materials to the parts of the object we want the materials on. I want the <code>wood1</code> on the <b>base of the lamp model</b>, the <code>metal1</code> on the <b>pole of the lamp</b>, the <code>cloth1</code> on the <b>cone part of the lamp</b> and the <code>light1</code> on the <b>base and top of the cone part of the lamp</b> (to simulate a light bulb). To do this we have to enter <code>Edit Mode</code> (pressing <b>Tab</b> while the cursor is on the same location as the <b>model/3d view area</b>), then change to the <b>face selection method</b>, select the faces of the model in which we want our material to be added, click on the material that you want to assign to those faces and click on the <code>Assign</code> button (<b>Fig. 10a, 10b, 10c and 10d</b>).</p> 

      <img src="../../images/t1/fig10a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 10a - Assign <code>wood1</code> to respective faces of model)</p>
      <br>

      <img src="../../images/t1/fig10b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 10b - Assign <code>metal1</code> to respective faces of model)</p>
      <br>

      <img src="../../images/t1/fig10c.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 10c - Assign <code>cloth1</code> to respective faces of model)</p>
      <br>

      <img src="../../images/t1/fig10d.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 10d - Assign <code>light1</code> to respective faces of model)</p>
      <br>

      <p><b>To be able to see your materials assigned to the model</b>, click on the <code>World tab</code>, scroll down and check the <code>Enviroment Lighting</code>, then, change to <code>Material view</code> (<b>Fig. 11 and 12</b>).</p>

      <img src="../../images/t1/fig11.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 11 - Check the <code>Enviroment Lighting</code> option)</p>
      <br>

      <img src="../../images/t1/fig12.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 12 - Change to <code>Material tab</code>)</p>
      <br>

      <p>You might see that the colors of your textures are applied to the faces but not the image textures (<b>Fig. 12</b>). To solve this you have to <b>unwrap the faces of your object</b>: on <code>Edit Mode</code> <b>double press A to select all faces of the model</b>, press U and select <code>Unwrap</code> (<b>Fig. 13 and 14</b>).</p>

      <img src="../../images/t1/fig13.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 13 - Unwrap procedure)</p>
      <br>

      <img src="../../images/t1/fig14.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 14 - Unwrap effect)</p>
      <br>

      <hr>
      <p><b>Note 1:</b> you can also select <code>Smart UV Project</code>. Both options do different stuff and in some cases it is preferable the effect of one in relation to the other.</p>
      <hr>

      <br>

      <p>My textures did not assign very well so I had to adjust them a little. I used <code>Smart UV Project</code> to the faces of the cone part of the lamp and also scaled the image of the <code>light1</code> material in <b>UV Editing</b> so more light is seen (<b>Fig. 15</b>).</p>

      <img src="../../images/t1/fig15.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 15 - Smart UV Project effect)</p>
      <br>

      <p>Now, you have to apply a <b>triangulate modifier</b> to the model, click on <code>Modifiers</code>, <code>Add Modifier</code>, <code>Triangulate</code>, verify that you are on <code>Object Mode</code>, select your model and then click on <code>Apply</code> (<b>Fig. 16 and 17</b>).</p>

      <img src="../../images/t1/fig16.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 16 - Triangulate modifier)</p>
      <br>

      <img src="../../images/t1/fig17.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 17 - Applying triangulate modifier)</p>
      <br>

      <hr>
      <p><b>Note 2:</b> this is done because the collision of the object depends on triangles, if your model is not triangulated you will pass through it on game or will have weird collision.</p>
      <hr>

      <br>

      <p>At this point the object is ready <b>to continue with the tutorial</b>, if you want to apply <b>other modifiers</b> and detail your model a little more and such you will have to learn how to use <code>Blender</code> better from tutorials in <b>Youtube</b>. Don’t try difficult stuff at start, you will get frustrated, do <b>SM64</b> or <b>OoT like-objects first</b>, at the end, when you get the rhythm of it, you will get better making more defined and detailed objects.</p>

      <p><b>Export the object as an FBX file and an OBJ file</b> (to a known location) by going to <code>File > Export</code> (<b>Fig. 18</b>). Name both files the same (the <b>OBJ</b> will come with an <b>MTL</b> file - <b>Fig. 19 and 20</b>). Try putting the <b>FBX, OBJ and MTL files</b> in the same directory as the <b>textures you used</b>. This is in case you are working in various computers to not get errors with the textures like me (<b>Fig. 21</b>).</p>

      <img src="../../images/t1/fig18.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 18 - Export option)</p>
      <br>

      <img src="../../images/t1/fig19.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 19 - FBX file export)</p>
      <br>

      <img src="../../images/t1/fig20.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 20 - OBJ file export)</p>
      <br>

      <img src="../../images/t1/fig21.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 21 - Folder containing textures and exported <code>Blender</code> files)</p>
      <br>

      <p>Now you can close <code>Blender</code> (<b>save your blender project files, just in case</b>) and we are going to enter the <b>file conversion part of the tutorial</b> to be able to get a file of the model we've worked on that can be <b>introduced in the game</b>.</p>

      <p>We will be using <b>3 programs</b> of the 5 mentioned at the beginning of the tutorial: <code>SuperBMD</code>, <code>Collision Creator</code> and <code>Arc Covertor</code>. Be sure to have them organized in respective folders to use them (<b>Fig. 22</b>).</p>
        
      <img src="../../images/t1/fig22.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 22 - Tools organized in folders)</p>
      <br>

      <p>First locate where all your needed files are (<b>Fig. 23</b>).</p>

      <img src="../../images/t1/fig23.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 23 - Textures and exported <code>Blender</code> files folder)</p>
      <br>

      <p><b>Open a New window</b> and in that window locate the <code>SuperBMD</code> tool (<b>Fig. 24a</b> - keep the window of your needed files open). <b>Drag and drop the FBX file</b> into the <code>superbmd_rotate.bat</code>. A <b>BMD file</b> will appear in the same folder as the <b>FBX file</b> (this is a file that contains your model - <b>Fig. 24b</b>).</p>

      <img src="../../images/t1/fig24a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 24a - <code>SuperBMD</code> tool folder)</p>
      <br>

      <img src="../../images/t1/fig24b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 24b - BMD file creation)</p>
      <br>

      <p>Open the <b>BMD file</b> created with <code>j3dview</code> (<code>File > Open Model...</code> - <b>Fig. 25a</b>) and <b>save it as a BDL file</b> in the same location the <b>BMD file</b> is (<code>File > Save Model As...</code> - <b>Fig. 25b</b>). This is done to <b>correct material lightning display issues in game</b> that <code>SuperBMD</code> does not cover yet (<b>very important step in the next tutorials!</b>).</p>

      <img src="../../images/t1/fig25a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 25a - BMD file opened in <code>j3dview</code>)</p>
      <br>

      <img src="../../images/t1/fig25b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 25b - Saving BMD file as BDL from <code>j3dview</code>)</p>
      <br>

      <p>Locate the <code>Collision Creator</code> tool (<code>NeoKCLCreate</code>), <b>open it</b>, go to <code>File > New</code> and select the <b>OBJ file of your custom model</b> (<b>Fig. 26a and 26b</b>).</p>

      <img src="../../images/t1/fig26a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 26a - <code>Collision Creator</code> tool opened - <code>NeoKCLCreate</code>)</p>
      <br>

      <img src="../../images/t1/fig26b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 26b - OBJ file opened in <code>NeoKCLCreate</code>)</p>
      <br>

      <p>Set the <code>Sound Code</code>, <code>Floor Code</code> and <code>Wall Code</code> to the values you want <b>for each material used in the model</b>:</p>

      <p><b>1)</b> <code>Sound Code</code>: <b>the sound that the material emits when Mario steps on it</b>.</p>

      <p><b>2)</b> <code>Floor Code</code>: <b>the properties the material has that affects Mario when walking on the material</b>.</p>

      <p><b>3)</b> <code>Wall Code</code>: <b>the property the material has that affects Mario when wall grabbing to the material</b>.</p>

      <p>I don’t know about the other options yet so I won’t explain them.</p>

      <p>I will only modify the <code>Sound Code</code> of <b>each material</b> since this is not a very complicated object. I will set the <code>Metal</code> value to the <code>metal1</code> material (<b>Fig. 27a</b>), <code>Wood</code> to the <code>wood1</code> material (<b>Fig. 27b</b>), <code>Carpet</code> to the <code>cloth1</code> material (<b>Fig. 27c</b>) and <code>Cloud</code> to the <code>light1</code> material (didn’t knew what to assign to a light as sound to be honest - <b>Fig. 27d</b>).</p>

      <img src="../../images/t1/fig27a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 27a - <code>metal1</code> sound code)</p>
      <br>

      <img src="../../images/t1/fig27b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 27b - <code>wood1</code> sound code)</p>
      <br>

      <img src="../../images/t1/fig27c.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 27c - <code>cloth1</code> sound code)</p>
      <br>

      <img src="../../images/t1/fig27d.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 27d - <code>light1</code> sound code)</p>
      <br>

      <p>After that, click on <code>File</code>, then <code>Save</code> and you can now close the program. A <b>KCL and PA files</b> will appear on the same folder as the <b>OBJ file</b> (<b>Fig. 28</b>). <b>These are the collision files for your object in game</b>.</p>

      <img src="../../images/t1/fig28.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 28 - KCL and PA files creation)</p>
      <br>

      <p><b>Create a folder named exactly as your model without the file extension</b> (in my case it will be named <code>tutorial1</code>) and place the <b>BDL, KCL and PA files</b> inside of it (<b>Fig. 29a and 29b</b>).</p>
        
      <img src="../../images/t1/fig29a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 29a - Folder creation)</p>
      <br>

      <img src="../../images/t1/fig29b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 29b - BDL, KCL and PA files inside folder)</p>
      <br>

      <p>Then, <b>in the other window</b>, locate the <code>Arc Convertor</code> tool and <b>drag and drop</b> the folder created to the <code>arcPack.exe</code> file. An <b>ARC file</b> will appear in the same place the folder is (<b>Fig. 30</b>). Now <b>drag and drop</b> the <b>ARC file</b> into the <code>yaz0enc.exe</code> file, an <b>ARC.YAZ0 file</b> will appear in the same place the <b>ARC file</b> is (<b>Fig. 31</b>).</p>

      <img src="../../images/t1/fig30.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 30 - ARC file creation)</p>
      <br>

      <img src="../../images/t1/fig31.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 31 - ARC.YAZ0 file creation)</p>
      <br>

      <p><b>Delete the first ARC file</b> (you don’t need it anymore) and rename the <b>ARC.YAZ0 file to ARC only</b>. That file will be the one that you will import into the game through <code>Whitehole</code>.</p>

      <p>Copy the <b>ARC file</b> got into the <code>ObjectData</code> folder of your <b>SMG1 dump</b> and then open <code>Whitehole</code>. Go to <code>Tools > BCSV Editor > Open > Objects > PlanetMapDataTable</code>. You should see a <b>large table</b> (<b>Fig. 32</b>).</p>

      <img src="../../images/t1/fig32.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 32 - <code>PlanetMapDataTable</code> in <code>Whitehole</code>'s BCSV editor)</p>
      <br>

      <p>Click on <code>Add row</code> and scroll down to the <b>end of the table</b>. In the empty row created type from left to right the following: <b>Name of your object, 0, 0, 0, 0 and 0</b> (<b>Fig. 33</b> - in my case the name is <code>tutorial1</code>). <b>Click save and open the galaxy you want your model in</b> (I will choose <code>AstroGalaxy</code> - <b>Fig. 34</b>).</p>

      <img src="../../images/t1/fig33.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 33 - Create and fill new row)</p>
      <br>

      <img src="../../images/t1/fig34.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 34 - <code>AstroGalaxy</code> galaxy opened on <code>Whitehole</code>)</p>
      <br>

      <p><b>Add an object</b> through <code>Objects > Add object > Normal</code>, input your desired object name on the search bar (I will choose a simple <b>coin</b>) and place it anywhere on the galaxy (<b>Fig. 35</b>). Then, click on the object and change its <code>Object</code> property to <b>the name of the model you created</b> (press Enter). Scale it to a viewable size and <b>BAM!</b> the model should show up (<b>Fig. 36a and 36b</b>).</p>

      <img src="../../images/t1/fig35.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 35 - A <code>Coin</code> placed on the galaxy)</p>
      <br>

      <img src="../../images/t1/fig36a.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 36a - Changing the <code>Coin</code> properties)</p>
      <br>

      <img src="../../images/t1/fig36b.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 36b - Model imported into the galaxy)</p>
      <br>

      <p>Now to test it on game, either with <b>Dolphin</b> or <b>Riivolution</b> (<b>Fig. 37</b>)</p>

      <img src="../../images/t1/fig37.jpg" alt="Image could not be loaded.">
      <p class="idtext">(Fig. 37 - Mario standing over the model on game)</p>
      <br>
      
      <br>

			<hr id="other-tutorials">
			<h2>Other tutorials</h2>
			<hr>

      <p>This guide was based in the following tutorials:</p>
      
      <ul>
        <li><a href="https://www.youtube.com/watch?v=cYg3ea2ihpY">By Luma48</a></li>
        <li><a href="https://www.youtube.com/watch?v=5LoPi4fNo9Y">By Alex SMG</a></li>
      </ul>
      
      <br>

		</div>

	</body>

</html>
